import * as api from "../api"
import {defineStore} from "pinia"

export const useUser = defineStore('users',{
    state(){
        return {
            productData:[]
        }
    },
    actions:{
        // 发起请求，获取数据
        async fetchData(){
            try{
                let res = await api.fetchProduct()
                // console.log(res)
                this.productData = res.data
            }
            catch(e){
                console.log(e)
            }
            
        }
        
    }
})